How to generate Summary Data and Extended Data

EMu 10 includes the option to use Standards module definitions to generate the Summary Data and Extended Data in a module, or system-wide.

Standards module scripting

The process for defining Standards record is described in How to define a standard in EMu using a Format Specifier of type Script.

Here we describe how to define Standards records to generate the Summary Data and Extended Data for a module; it should be read in conjunction with How to define a standard in EMu.

In all cases, string generation code should be placed within EMu’s standard structure for generating strings as shown below:

Definition

This structure caters for both single language and multi-language systems. The evaluation of the text for the generated string occurs within the for loop. The evaluated string is passed back to EMu through the return statement.

The fieldFormat function has access to the fields array, which contains information that can be used within the fieldFormat function. The fields array contains three rows (index is 0 based) of information. These are:

0

A decoder that decodes JSON (JavaScript Object Notation) strings.

1

A JSON string that contains data elements.

2

A JSON string that contains System Lookup List values.

An example of a JSON string that contains the irn and SummaryData for a record might look like:

{
    “irn”:12345,
    “SummaryData”:”This is the Summary Data of a record”
}

To access the individual elements (irn and SummaryData) of the JSON string, the JSON string needs to be decoded. This is done by the first two lines of the fieldFormat function:

    my $decoder = $fields[0];
    my $json = &{$decoder}($fields[1]);

Line one accesses the decoder from the first row (0 based index) of the fields array.

Line two uses the decoder to decode the JSON data string that is held in the second row of the fields array and places the output in the $json variable. Individual field (column) data can be accessed through the $json variable, e.g.:

$json->{irn} or $json->{SummaryData}

Line three uses the decoder to decode the JSON data string that is held in the third row of the fields array and places the output in the $luts variable. Individual System Lookup List data, e.g. System Yes, can be accessed through the variable, e.g.:

$luts->{Yes} or $luts->{No}

Note: When accessing System Lookup List data the name (with the word System removed) of the System Lookup List is used to get its value. For System Yes this is Yes, i.e.: $luts->{Yes}

The settings used by multiple language systems are handle by lines four and five:

    my $langcount = (defined($ENV{EMULANGCOUNT}) ? $ENV{EMULANGCOUNT} : 1);
    my $langdelim = (defined($ENV{EMULANGDELIM}) ? $ENV{EMULANGDELIM} : ";:;");

Line four sets the language count and line five sets the language delimiter. The for loop uses these settings for generating the correct language strings for each language.

Predefined functions

A number of predefined functions are included to assist with the generation of the data strings: